import request from '@/utils/request'
/**
 * 获取角色列表
 * ***/
export const reqGetRoleList = (page, pagesize, index) => {
  return request({
    method: 'get',
    url: '/sys/role',
    params: {
      page,
      pagesize,
      index
    }
  })
}

/**
 * 删除角色
 ***/
export const reqDeleteRole = (id) => {
  return request({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

/** *
 * 新增角色
 * ***/
export const reqAddRole = (form) => {
  return request({
    method: 'post',
    url: '/sys/role',
    data: form
  })
}

/** *
 * 修改角色
 * **/
export function reqUpdateRole(form) {
  return request({
    method: 'put',
    url: `/sys/role/${form.id}`,
    data: form
  })
}

/**
   * 根据 id 获取角色详情, 用于回显
   * **/
export function reqGetRoleDetail(id) {
  return request({
    method: 'get',
    url: `/sys/role/${id}`
  })
}

// 根据 id 查询企业
export const reqGetCompanyById = (id) => {
  return request({
    method: 'get',
    url: `/company/${id}`
  })
}

